import Util.Util;

public class p7 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int limit = 10001;
		int cnt = 1; // for 2

		int candidate = 1;

		while (cnt < limit) {
			candidate += 2;
			if (isPrime(candidate)) {
				cnt++;
			}
		}
		System.out.println(candidate);

		cnt = 1;
		candidate = 1;
		// advanced method
		while (cnt < limit) {
			candidate += 2;
			if (Util.IsPrime(candidate)) {
				// System.out.println(candidate);
				cnt++;
			}
		}
		System.out.println(candidate);
	}

	static boolean isPrime(long n) {
		for (long i = 2; i < n / 2; i++) {
			if (n % i == 0) {
				return false;
			}
		}
		return true;
	}
}
